package lab03.test04;

import java.io.*;

/**
 * Created by 14394 on 2017/11/17.
 */
public class Test04 {
    public static void main(String[] args) {
        String source="D:\\dev\\test.html";
        String target="F:\\dev\\test.html";

        InputStream inputStream=null;
        OutputStream outputStream=null;

        try {
            inputStream=new FileInputStream(source);
            outputStream=new FileOutputStream(target);

            int data;

            while ((data=inputStream.read())!=-1){
                    outputStream.write(data);
            }


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (inputStream!=null||outputStream!=null){
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                try {
                    outputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
